#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int Pa, Pb;
	scanf("%d %d", &Pa, &Pb);
	int s[3];
	int i;
	int suma = 0;
	int sumb = 0;
	for (i = 0; i < 3; i++)
	{
		scanf("%d", &s[i]);
		if (s[i] == 0)
		{
			suma++;
		}
		else
		{
			sumb++;
		}
	}
	if ((Pa > Pb && suma >= 1) || (suma == 3))
	{
		printf("The winner is a: %d + %d", Pa, suma);
	}
	else if ((Pb > Pa && sumb >= 1) || (sumb == 3))
	{
		printf("The winner is b: %d + %d", Pb, sumb);
	}
	return 0;
}